package control;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

import view.LibraryMainJFrame;
import view.NotCloseableException;

@SuppressWarnings("serial")
public class ExitApplicationAction extends AbstractAction {
	private LibraryMainJFrame mainFrame;

	public ExitApplicationAction(LibraryMainJFrame frame){
		super("Beenden");
		putValue(MNEMONIC_KEY, KeyEvent.VK_B);
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));

		mainFrame = frame;
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		try {
			mainFrame.closeFrame();
		} catch (NotCloseableException e) {
		}
	}

}
